*******************************************************************************
*
* CODE TO CLEAN 1997 GALLUP DATA FOR REPLICATION OF GALLUP GRAPH
* "GLOBAL WARMING ATTITUDES FROZEN SINCE 2016", APRIL 5, 2021
* https://news.gallup.com/poll/343025/global-warming-attitudes-frozen-2016.aspx
* GRAPH "VIEWS THAT EFFECTS OF GLOBAL WARMING HAVE ALREADY BEGUN"
*
* FOR PAPER: 
* Learning from Shared News: When Abundant Information Leads to Belief Polarization
* Bowen, Dmitriev, Galperti
* Quarterly Journal of Economics
*******************************************************************************

******************************
* LOAD DATA
******************************
** Gallup News Service Poll: Ethical Standards/Abortion/Environment [Roper #31088755], 11/06/97-11/09/97
* https://ropercenter.cornell.edu/ipoll/study/31088755/
* Converted into .dta from .por using R using code "1. gallup_rep_code_1997convert.R"

use "${data}\gallup1997.dta", clear

******************************
* DATA CLEANING
******************************
** Rename variables
	* Weight
	rename WEIGHT wtfctr
	* Year
	gen yr = 1997
		la var yr "Year of Interview"
	* Party (independents combined with lean republican and lean democrat)
	tab D7, gen(party)
		* Republican
		rename party1 reprr
		rename party2 demrr
		rename party3 indeprr
		
		drop party4-party5
		
	* When effects of global warming have begun
	rename Q30 gw_when
	
		* Gen dummy for "Already begun"
		tab gw_when, gen(gw_when)
		
		rename gw_when1 gw_when_already
		
		drop gw_when2-gw_when6
	
	* Censor values in rep, dem, indep that didn't answer the global warming question
	foreach var of varlist reprr indeprr demrr {
		replace `var'=. if missing(gw_when)
	}

** Keep only data needed for append with 2000-2022 data
keep yr wtfctr reprr demrr indeprr gw_when_already

order yr wtfctr reprr demrr indeprr gw_when_already

******************************
* SAVE TO DTA FOR APPEND
******************************
save "${data}\gallup1997_forappend.dta", replace